﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HostpitalManage.GUI
{
    public partial class Reception : Form
    {
        DAO.ReceptionManagementConnection connect = new DAO.ReceptionManagementConnection();
        public Reception()
        {
            InitializeComponent();
            hienThiBenhNhan();

        }

        public void timKiemBenhNhan() {
            String id = txtIDBn.Text;
            String name = TxtFullName.Text;
            DataTable dt = connect.timKiemBenhNhan(id,name);
            DanhSachBenhNhan.DataSource = dt;
        }

        public void hienThiBenhNhan() {
            DataTable dt = connect.hienThiBenhNhan();
            DanhSachBenhNhan.DataSource = dt;
        }

        public void timKiemBenhNhanHenKham() {
            DateTime ngayHenKham = monthCalendar1.SelectionRange.Start;
            DataTable dt = connect.timKiemBenhNhanHenKham(ngayHenKham);
            DanhSachHenKham.DataSource = dt;
        }

        private void btSearch_Click(object sender, EventArgs e)
        {
            
            try
            {
                timKiemBenhNhan();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                
            }
        }

        private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
        {
            timKiemBenhNhanHenKham();
        }
        private void txtIDBn_KeyPress(object sender, KeyPressEventArgs e)
        {
            timKiemBenhNhan();
        }

        private void Reception_Load(object sender, EventArgs e)
        {

        }

        private void DanhSachBenhNhan_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

    }
}
